﻿function TroubleshootingViewModel() {
    var self = this;
    self.showButton = function (value, cellmeta, record, rowIndex, columnIndex, store) {
 
        var url = '<div class="btn-group"><a data-toggle=\"ajaxModal\" class=\"btn btn-default btn-xs\" data-search=\"\" href=\"/Troubleshooting/Confirmation/' +
            record.data.Id +
            '?ListControlId=%23troubleshootingDataList\">确认</a>';
        if (record.data.Confirmation && record.data.Confirmation.DangerConfirmation == null) {

        }

        if (record.data.Confirmation && record.data.Confirmation.DangerConfirmation == true) {
            url += '<a data-toggle=\"ajaxModal\" class=\"btn btn-default btn-xs\" href=\"/Troubleshooting/Rectification/' + record.data.Id + '\">整改</a>';
        } else {
            url += '<a class=\"btn btn-default btn-xs disabled\" href=\"#\">整改</a>';
        }
        //整改日期
        if (record.data.Rectification && record.data.Rectification.RectificationDate) {
            url += '<a data-toggle=\"ajaxModal\" class=\"btn btn-default btn-xs\" href=\"/Troubleshooting/Acceptance/' + record.data.Id + '\">验收</a>';
        } else {
            url += '<a class=\"btn btn-default btn-xs disabled\" href=\"#\">验收</a>';
        }
        if (record.data.Acceptance && record.data.Acceptance.AcceptanceTime)
            url += '<a data-toggle=\"ajaxModal\" class=\"btn btn-default btn-xs\" href=\"/Troubleshooting/WriteOff/' + record.data.Id + '\">销账</a>';
        else
            url += '<a class=\"btn btn-default btn-xs disabled\" href=\"#\">销账</a>';

        return url+"</div>";
    }

}